import Vue from "vue";

export default async function({
  url,
  method,
  data = {}
} = {}) {
  let opt = {
    url,
    method,
    data,
    emulateJSON: true
  };
  let response;
  response = await Vue.http(opt);

  let respData = response.data;
  if (respData.resCode === "0000") {
    return respData;
  } else if (respData.resCode === "1111") {
    return respData;
  } else if (respData.resCode === "3333") {
    return respData;
  } else if (respData.resCode === "1112") {
    return respData;
  } else {
    return Promise.reject(respData);
  }

}
